package com.by;

import com.by.factory.Factory;
import com.by.factory.FactoryA;
import com.by.factory.FactoryB;
import com.by.product.Product;

/**
 * Hello world!
 *
 */
public class Application {
    public static void main(String[] args) {
        // 使用工厂 A 创建产品
        Factory factoryA = new FactoryA();
        Product productA = factoryA.createProduct();
        productA.use(); // 输出 "Using Product A"

        // 使用工厂 B 创建产品
        Factory factoryB = new FactoryB();
        Product productB = factoryB.createProduct();
        productB.use(); // 输出 "Using Product B"

        // 测试通用逻辑
        factoryA.doSomething(); // 输出 "Using Product A"
        factoryB.doSomething(); // 输出 "Using Product B"
    }
}